﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;

namespace Vehicle.DAL
{

    /// Copyright (C) M-Tear团队
    /// 文 件 名：Base_DAL.cs
    /// 版    本：v1.00.0000
    /// 创建标识：2009-08-26    Created by 杨光远 V1.00.0000
    /// 功能说明：数据层基类（可让其他类之间继承通用方法）
    /// 注意事项：无
    /// 
    /// 更新记录：
    /// 
    /// </summary>
    public class Base_DAL : Vehicle.Interface.IBase_DAL
    {
        /// <summary>
        /// 通用删除方法
        /// </summary>
        /// <param name="m_Components"></param>
        public void Delete(Model.ComponentsInfo m_Components)
        {
            string SpName = "AllDelete";
            object[] _object = new object[] { 0, m_Components.tableName, m_Components.condition, m_Components.result,m_Components.Tcondition,m_Components.Tresult };
           
           SqlHelper.ExecuteNonQuery(SpName, _object);
        }
        /// <summary>
        /// 通过标题或时间获得数据总数
        /// </summary>
        /// <param name="m_Components">通用实体层</param>
        /// <returns>总数</returns>
        public int GetAllSearchCount(Model.ComponentsInfo m_Components)
        {

            string SpName = "AllSearchCount";
            object[] _object = new object[] { 0, m_Components.startIndex, m_Components.endIndex, m_Components.tableName, m_Components.condition, m_Components.result, m_Components.Tcondition, m_Components.Tresult,m_Components.Scondition,m_Components.Sresult, m_Components.Count, m_Components.Title, m_Components.TCount, m_Components.StartTime.ToString(), m_Components.EndTime.ToString(), m_Components.order };
            return SqlHelper.GetDataTable(SpName, _object).DefaultView.Count;
        }
        /// <summary>
        /// 获得数据总数
        /// </summary>
        /// <param name="m_Components">通用实体层</param>
        /// <returns>总数</returns>
        public int GetAllCount(Model.ComponentsInfo m_Components)
        {
            
            string SpName = "AllGetModel";
            object[] _object = new object[] { 0, m_Components.tableName, m_Components.condition, m_Components.result, m_Components.Tcondition, m_Components.Tresult, m_Components.Scondition, m_Components.Sresult, m_Components.order };
            return SqlHelper.GetDataTable(SpName, _object).DefaultView.Count;
        }
        /// <summary>
        /// 通用获得数据
        /// </summary>
        /// <param name="m_Components">通用实体层</param>
        /// <returns>返回DataTable</returns>
        public DataTable GetModel(Model.ComponentsInfo m_Components)
        {
            string SpName = "AllGetModel";
            object[] _object = new object[] { 0, m_Components.tableName, m_Components.condition, m_Components.result, m_Components.Tcondition, m_Components.Tresult,m_Components.Scondition,m_Components.Sresult, m_Components.order };
            return SqlHelper.GetDataTable(SpName, _object);
        }

        /// <summary>
        /// 通用通过标题或时间获得分页数据
        /// </summary>
        /// <param name="m_Components">通用实体层</param>
        /// <returns></returns>
        public DataTable GetAllSearch(Model.ComponentsInfo m_Components)
        {
         
            string SpName = "AllSearch";
            object[] _object = new object[] { 0, m_Components.startIndex, m_Components.endIndex, m_Components.tableName, m_Components.condition, m_Components.result, m_Components.Tcondition, m_Components.Tresult,m_Components.Scondition,m_Components.Sresult, m_Components.Count,m_Components.Title,m_Components.TCount,m_Components.StartTime.ToString(),m_Components.EndTime.ToString(),  m_Components.order };
            return SqlHelper.GetDataTable(SpName, _object);
        }
        /// <summary>
        /// 通用更新只能更新一个值
        /// </summary>
        /// <param name="m_Components">通用实体层</param>
        public void AllUpdate(Model.ComponentsInfo m_Components)
        {
            string SpName = "AllUpDate";
            object[] _object = new object[] {0,m_Components.tableName,m_Components.condition,m_Components.result,m_Components.Tcondition,m_Components.Tresult};
            SqlHelper.ExecuteNonQuery(SpName, _object);
        }
 

    }
}
